Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blakek/is-promise

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blakek/is-promise

✅ check if a value is Promise-like

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@blakek/is-promise

✅ check if a value is Promise-like

Sometimes it makes sense to treat Promises and non-Promises differently. For example, it can be helpful to only return a Promise if given a Promise. This package helps with that.

If just checking to call .then(), you may be wanting to use the built-in Promise.resolve().

Install

Using Yarn:

$ yarn add @blakek/is-promise

…or using npm:

$ npm i --save @blakek/is-promise

Usage

import { isPromise } from '@blakek/is-promise';

isPromise('test'); //» false

isPromise(Promise.resolve('test')); //» true

isPromise({ then: () => 'non-standard promise' }); //» true

Contributing

Node.js and Yarn are required to work with this project.

To install all dependencies, run:

yarn

Useful Commands

yarn buildBuilds the project to ./dist
yarn formatFormat the source following the Prettier styles
yarn testRun project tests
yarn test --watchRun project tests, watching for file changes

License

MIT

Keywords

FAQs

Package last updated on 24 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc